import net.sf.json.JSONObject;
import net.xilou.weibo.HttpClientHelper;
import net.xilou.weibo.MatcherHelper;
import java.util.regex.Matcher;

/**
 * Created by yong on 2016/3/19.
 */
public class Index {
    public static void main(String[] args) throws Exception {
        try {
            String loginUrl = "https://passport.weibo.cn/signin/login?entry=mweibo&res=wel&wm=3349&r=http%3A%2F%2Fm.weibo.cn%2F";
            String url = "http://m.weibo.cn/u/5175980794";
            String html = HttpClientHelper.get(url);
//            System.out.println(html);

            Matcher match = MatcherHelper.match(html, "\"uid\":\"([0-9]+)\"");
            if(match.find()) {
                String uid = match.group(1);
                System.out.println(uid);
            } else {
                System.out.println("no pattern");
            }

            Matcher match2 = MatcherHelper.match(html, "render_data = ([\\s\\S]+?);</script>");
            if(match2.find()) {
                String stage = match2.group(1);
                System.out.println(stage);
                JSONObject jsonObject = JSONObject.fromObject(stage);
                System.out.println(jsonObject.toString());
            } else {
                System.out.println("no pattern");
            }
        } finally {
        }
    }
}
